<?php
/**
 * Blog system
 * 
 * @author  baogg
 * @version  1.0
 */
include '../config/config.php';

error_reporting ( E_ALL | E_STRICT );
ini_set ( 'display_errors', 1 );
header("charset:{BAOGG_CHARSET}");

$aIncludePath = array ();
$aIncludePath [] = realpath ( BAOGG_UPLOAD_DIR . '../library' ) . "/";
$aIncludePath [] = realpath ( BAOGG_UPLOAD_DIR . '../../zf/library' ) . "/";
$aIncludePath [] = realpath ( BAOGG_UPLOAD_DIR . '../application/default/models' ) . "/";
$aIncludePath [] = realpath ( BAOGG_UPLOAD_DIR . '../application/System/models' ) . "/";
$aIncludePath [] = realpath ( BAOGG_UPLOAD_DIR . '../application/Blog/models' ) . "/";
//$aIncludePath [] = get_include_path ();
set_include_path ( implode ( PATH_SEPARATOR, $aIncludePath ) );

include_once "Zend/Loader.php";
//echo "<pre>";var_dump(BAOGG_BASE_URL);exit;
Zend_Loader::registerAutoload ();
Zend_Loader::loadClass ( "Baogg_Db" );
Zend_Loader::loadClass ( "Baogg_Controller" );
Zend_Loader::loadClass ( "Baogg_Controller_Plugin" );
date_default_timezone_set ( 'Asia/Hong_Kong' );

/**
 * Setup controller
 */
$controller = Zend_Controller_Front::getInstance ();
$aControllerDirectory ['default'] = realpath ( BAOGG_UPLOAD_DIR . '../application/default/controllers' ) . "/";
$aControllerDirectory ['system'] = realpath ( BAOGG_UPLOAD_DIR . '../application/System/controllers' ) . "/";
$aControllerDirectory ['blog'] = realpath ( BAOGG_UPLOAD_DIR . '../application/Blog/controllers' ) . "/";
$controller->setControllerDirectory ( $aControllerDirectory );
$controller->registerPlugin ( new Baogg_Controller_Plugin ( ) );
$controller->throwExceptions ( true ); // should be turned on in development time



$controller->setBaseUrl ( BAOGG_BASE_URL );
$_SESSION ['s_user_id'] = 1;
// run!
$controller->dispatch ();
